        <!DOCTYPE html>
        <html lang="zh" xmlns:th="http://www.thymeleaf.org">
        <head>
            <th:block th:include="include :: header('用户数据源修改')" />
            <th:block th:include="include :: select2-css" />
            <th:block th:include="include :: bootstrap-select-css" />
            <th:block th:include="include :: bootstrap-fileinput-css" />
        </head>
        <body class="white-bg">
        <div class="wrapper wrapper-content animated fadeInRight ibox-content">
            <form class="form-horizontal m" id="form-config-edit" name="form-config-edit" th:object="${userDataSource}" >
                <h4 class="form-header h4">用户数据源修改</h4>
<!--                <input th:field="*{picUrl}" class="form-control" readonly="readonly" type="hidden"/>-->
                <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-sm-4 control-label is-required">数据源名称：</label>
                            <div class="col-sm-8">
                                <input id="dataSourceName" name="dataSourceName" class="form-control" type="text" th:field="*{dataSourceName}" required>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-sm-4 control-label is-required">数据库地址：</label>
                            <div class="col-sm-8">
                                <input id="dataUrl" name="dataUrl" class="form-control" type="text" th:field="*{dataUrl}" required>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-sm-4 control-label is-required">数据库端口：</label>
                            <div class="col-sm-8">
                                <input id="dataPort" name="dataPort" class="form-control" type="text" th:field="*{dataPort}" required>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-sm-4 control-label is-required">数据库/ODBC：</label>
                            <div class="col-sm-8">
                                <input id="dataOdbc" name="dataOdbc" class="form-control" type="text" th:field="*{dataOdbc}" required>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-sm-4 control-label is-required">数据库用户名：</label>
                            <div class="col-sm-8">
                                <input id="dataUser" name="dataUser" class="form-control" type="text" th:field="*{dataUser}" required>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-sm-4 control-label is-required">数据库密码：</label>
                            <div class="col-sm-8">
                                <input id="dataPassword" name="dataPassword" class="form-control" type="text" th:field="*{dataPassword}" required>
                            </div>
                        </div>
                    </div>
                </div>



                <input id="id" name="id" class="form-control" type="hidden" th:field="*{id}" required>


                <div class="form-group">
                    <div class="col-sm-3">
                        <div th:object="${user}">
                            <input th:field="*{loginName}" class="form-control" readonly="readonly" type="hidden" name="updateUser"/>
                        </div>
                    </div>
                </div>
            </form>
        </div>

<!--        <div class="row">-->
<!--            <div class="col-sm-offset-5 col-sm-10">-->
<!--                <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存</button>&nbsp;-->
<!--                <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭-->
<!--                </button>-->
<!--            </div>-->
<!--        </div>-->

        <th:block th:include="include :: footer" />
        <script type="text/javascript">
            var prefix = ctx + "system/userDataSource";



            $("#form-config-edit").validate({
                onkeyup: false,
                onSubmit: true,
                rules: {
                    dataSourceName: {
                        remote: {
                            url: prefix + "/checkDataSourceNameUnique",
                            type: "post",
                            dataType: "json",
                            data: {
                                "id": function() {
                                    return $.common.trim($("#id").val());
                                },
                                "typeName": function() {
                                    return $.common.trim($("#dataSourceName").val());
                                }
                            },
                            dataFilter: function(data, type) {
                                return data;
                            }
                        }
                    }
                },
                messages: {
                    "dataSourceName": {
                        remote: "该数据源名称已存在"
                    }
                },
                focusCleanup: true
            });


            function submitHandler() {
                if ($.validate.form()) {
                    var formData = new FormData($('#form-config-edit')[0]);
                    // formData.append('file', $('#file')[0].files[0]);

                    $.ajax({
                        url: prefix + "/edit",
                        type: 'post',
                        cache: false,
                        data: formData,
                        processData: false,
                        contentType: false,
                        dataType: "json",
                        success: function(result) {
                            $.operate.successCallback(result);
                        }
                    });
                }
            }
        </script>
</div>
</body>
<th:block th:include="include :: footer" />
<th:block th:include="include :: select2-js" />
<th:block th:include="include :: bootstrap-select-js" />
<th:block th:include="include :: bootstrap-fileinput-js" />
</html>
